package com.cmarquez.rgb;

import java.io.BufferedWriter;
import java.io.DataInputStream;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.net.InetAddress;
import java.net.InetSocketAddress;
import java.net.Socket;


public class Arduino {
	private final static String BRIDGE = "finally.no-ip.org";
	private final static int PORT = 1234;
	private static final long DELAY = 50;

	public static void sendColors(int r, int g, int b)
	{
		try{	
			Socket s1 = new Socket(InetAddress.getByName(BRIDGE), PORT);
			System.out.println("Red: "+r+" Green: "+g+" Blue: "+b);
			OutputStream is = s1.getOutputStream();
			BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(is));
			bw.write(r+","+g+","+b);
			bw.close();
			s1.close();
			
		}
		catch (Exception e) {
			// TODO: handle exception
			e.printStackTrace();
		}

	}

}
